package po

import (
	"kafkademo/internal/po/section"

	apDependency "github.com/illidaris/aphrodite/pkg/dependency"
	"gorm.io/gorm"
)

type MqMessage struct {
	apDependency.EmptyPo
	Id                       string `json:"id" gorm:"column:id;type:varchar(36);primaryKey;comment:唯一ID"`  // identify id
	Topic                    string `json:"topic" gorm:"column:topic;type:varchar(32);comment:主题"`         // topic
	Partition                string `json:"partition" gorm:"column:partition;type:varchar(24);comment:分区"` // partition
	Key                      string `json:"key" gorm:"column:key;type:varchar(32);comment:key"`            // key
	Raw                      string `json:"raw" gorm:"column:raw;type:text;comment:原文"`                    // raw
	Ts                       int64  `json:"ts" gorm:"column:raw;type:bigint;comment:时间戳"`                  // ts
	BlockTs                  int64  `json:"blockts" gorm:"column:blockts;type:bigint;comment:block时间戳"`    // blockts
	section.OperationSection `gorm:"embedded"`
	DeletedAt                gorm.DeletedAt `json:"deleteAt" gorm:"type:bigint;;column:deleteAt;comment:软删标记"`
}

func (s MqMessage) TableName() string {
	return "mq_message"
}

func (s MqMessage) ID() any {
	return s.Id
}

func (s MqMessage) Database() string {
	return "main"
}
